<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let sum = 1000
        while(true){
            let i = +prompt(`
            请选择你的操作
            1.存钱
            2.取钱
            3.查看余额
            4.退出
            `)
            if(i===4){
                break
            }
            else
            switch(i){
            case 1: 
            let j=+prompt('请输入金额:')
            sum = sum+j
            alert(`余额:${sum}`)
            break
            case 2: 
            let z=+prompt('请输入金额:')
            if(z<sum){
                sum=sum-z
                alert(`余额:${sum}`)
            }
            alert('余额不足')
            break
            case 3: 
            alert(`余额还有${sum}`)
            break
        }
    }
    </script>
    
</body>
</html>